package com.liuzeyuan.service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liuzeyuan.dao.UserDao;
import com.liuzeyuan.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service("userService")
public class UserServiceImpl  implements UserService{
    @Autowired
    private UserDao userDao;
    public List<User> findAll(){
        return userDao.findAll();
    }

    @Override
    public void savaAll(List<User> users) {
        users.forEach(user -> {
            user.setId(null);
            //String substring = user.getPhoto().substring(user.getPhoto().lastIndexOf("/") + 1);
           // user.setPhoto(substring);
            userDao.save(user);
        });
    }

}
